//
//  HSQLogisticsInformationViewController.m
//  LiTianDecoration
//
//  Created by administrator on 2018/7/26.
//  Copyright © 2018年 administrator. All rights reserved.
//

#import "HSQLogisticsInformationViewController.h"
#import "HSQAccountTool.h"

@interface HSQLogisticsInformationViewController ()

@property (weak, nonatomic) IBOutlet UILabel *shipName_Label; // 快递公司名称

@property (weak, nonatomic) IBOutlet UILabel *shipSn_label; // 快递单号

@end

@implementation HSQLogisticsInformationViewController

- (void)viewDidLoad {
    
    [super viewDidLoad];
    
    self.navigationItem.title = @"物流信息";
    
    self.view.backgroundColor = KViewBackGroupColor;
    
    // 请求物流信息的数据
    [self RequestDataForLogisticsInformation];
}

/**
 * @brief 请求物流信息的数据
 */
- (void)RequestDataForLogisticsInformation{
    
    [[HSQProgressHUDManger Manger] ShowLoadingDataFromeServer:@"" ToView:self.view IsClearColor:YES];
    
    NSDictionary *params = @{@"token":[HSQAccountTool account].token,@"shipSn":self.shipSn,@"shipCode":self.shipCode};
    
    AFNetworkRequestTool *requestTool = [AFNetworkRequestTool shareRequestTool];
    
    [requestTool.manger POST:UrlAdress(KLogisticsInformationUrl) parameters:params progress:^(NSProgress * _Nonnull uploadProgress) {
        
    } success:^(NSURLSessionDataTask * _Nonnull task, id  _Nullable responseObject) {
        
        [[HSQProgressHUDManger Manger] DismissProgressHUD];
        
        HSQLog(@"===物流信息数据===%@",responseObject);
        
        if ([responseObject[@"code"] integerValue] == 200)
        {
            //  快递公司
            self.shipName_Label.text = [NSString stringWithFormat:@"物流公司：%@",responseObject[@"datas"][@"shipName"]];
            
            // 快递单号
            self.shipSn_label.text = [NSString stringWithFormat:@"运单号码：%@",responseObject[@"datas"][@"shipSn"]];
        }
        else
        {
            NSString *errorString = [NSString stringWithFormat:@"%@",responseObject[@"datas"][@"error"]];
            
            [[HSQProgressHUDManger Manger] ShowDisplayFailedToLoadData:errorString SuperView:self.view];
        }
        
        
    } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
        
        // 提示数据请求失败
        [[HSQProgressHUDManger Manger] ShowProgressHUDPromptText:KErrorPlacherString SupView:self.view];
    }];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}



@end
